# #99乘法表
# def cfkjb():
#     for i in range (1,10):
#         for j in range (1,i+1):
#             print(f'{i}*{j}={i*j}',end='\t')
#         print('')
#
#
# #矩阵
# def ju_zhen(a,b):
#     for i in range (1,a+1):
#         for j in range (1,b+1):
#             print(f"{i}--{j}",end='\t')
#         print('')
#
# print('我是myfunc')
# if __name__ == '__main__':
#     print('我只会在本地执行')
#猜数字大小游戏
def guess_num():
    import random
    x = random.randint(0, 100)
    def guess(a,x):

        if a==x:
            return('正确')
        elif a>x:
            return('猜大了')
        elif a<x:
            return('猜小了')

    for i in range(7):
        a = int(float(input('请输入0-100的数字：')))
        if guess(a, x) == '正确':
            print(f'猜对了，共猜了{i + 1}次')
            break
        else:
            print(guess(a, x))
            print(f'你还有{6 - i}次机会')
    print(f'正确答案是{x}')
#正则表达式搜索匹配字符串
import re
def get_str_by_re(left='\A',right='\Z',string=''):
    result = re.search(f'{left}(.*?){right}',string)
    if result !=None:
        return result.group(1)
    else:
        return '没有找到相匹配的内容'

